import { fileURLToPath, URL } from "node:url";

import { defineConfig ,loadEnv} from "vite";
import vue from "@vitejs/plugin-vue";

// https://vite.dev/config/
export default ({ mode }) => {
    const isWeb = loadEnv(mode, process.cwd()).VITE_PLATFORM === "development";
    console.log(isWeb);
    const config = {
        base: isWeb ? "/" : "./",
        server: {
            port: 3004,
        },
        plugins: [vue()],
        resolve: {
            alias: {
                "@": fileURLToPath(new URL("./src", import.meta.url)),
            },
        },
    };
    return defineConfig(config);
};
